package 黑马程序员Java基础;

import java.util.Scanner;

/**
 * @ClassName: [ArrayTest1]
 * @Description: 纯数字串转换为数组
 * @Author: [黄劲松]
 * @CreateDate: [2021-03-17]
 * @Version: [v1.0]
 */
public class ArrayTest1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str;
        System.out.println("请输入出数字的字符串：");
        str = scanner.nextLine();
        System.out.println("输出字符串：" + str);
        char[] numberArray = str.toCharArray();
        int[] intArray = new int[numberArray.length];
        for (int i = 0; i < numberArray.length; i++) {
            intArray[i] = numberArray[i] - '0';
            System.out.print(intArray[i] + " ");
        }
    }
}
